home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / pthd-0.000 / pthd-0 / pthd-0.7 / include / pthread_dce.h next >
Encoding:
C/C++ Source or Header  |  1995-08-16  |  4.3 KB  |  171 lines

  1. /*
  2.  * pthread_dce.h
  3.  */
  4.  
  5. #ifndef _pthread_dce_
  6. #define _pthread_dce_
  7.  
  8. #ifdef __cplusplus
  9.     extern "C" {
  10. #endif
  11.  
  12. /*
  13.  * These data types are used by POSIX Draft 4 and DCE threads, but not by
  14.  * Linux (POSIX) threads.
  15.  */
  16. typedef void *pthread_addr_t;
  17. typedef void *(*pthread_startroutine_t)(void *);
  18. typedef void  (*pthread_cleanup_t)(void *);
  19. typedef void  (*pthread_destructor_t)(void *);
  20. typedef void  (*pthread_initroutine_t)(void);
  21.  
  22. extern pthread_attr_t      pthread_attr_default;
  23. extern pthread_mutexattr_t pthread_mutexattr_default;
  24. extern pthread_condattr_t  pthread_condattr_default;
  25.  
  26. #ifdef _DCE_COMPAT_
  27.  
  28. #define TH_CHECK(st,str) \
  29. { \
  30.    if( st != SUCCESS ) \
  31.    {   int err; \
  32.        pthread_errno_np( NULL, &err ); \
  33.        pthread_lock_global_np(); \
  34.        fprintf( stderr, "%s failed:", str ); \
  35.        fprintf( stderr, "%d:%s ", __LINE__, __FILE__ ); \
  36.        fprintf( stderr, "%s:%d\n", sys_errlist[err] ); \
  37.        _exit(1); \
  38.        pthread_unlock_global_np(); \
  39.    } \
  40. }
  41.  
  42. #define pthread_attr_create         (pthd4_attr_create)
  43. #define pthread_attr_delete         (pthd4_attr_delete )
  44. #define pthread_attr_setstacksize   (pthd4_attr_setstacksize)
  45. #define pthread_attr_getstacksize   (pthd4_attr_getstacksize)
  46. #define pthread_create              (pthd4_create)
  47. #define pthread_detach              (pthd4_detach)
  48. #define pthread_exit                (pthd4_exit)
  49. #define pthread_join                (pthd4_join)
  50. #define pthread_self                (pthd4_self)
  51. #define pthread_mutex_init          (pthd4_mutex_init)
  52. #define pthread_mutex_destroy       (pthd4_mutex_destroy)
  53. #define pthread_cond_init           (pthd4_cond_init)
  54. #define pthread_cond_destroy        (pthd4_cond_destroy)
  55. #define pthread_keycreate           (pthd4_keycreate)
  56. #define pthread_setspecific         (pthd4_setspecific)
  57. #define pthread_getspecific         (pthd4_getspecific)
  58. #define pthread_cancel              (pthd4_cancel)
  59. #define pthread_testcancel          (pthd4_testcancel)
  60. #define pthread_setasynccancel      (pthd4_setasynccancel)
  61. #define pthread_setcancel           (pthd4_setcancel)
  62. #define pthread_get_expiration_np   (pthd4_get_expiration_np)
  63. #define pthread_yield               (pthd4_yield)
  64. #define pthread_once                (pthd4_once)
  65.  
  66. #endif
  67.  
  68. extern void
  69. pthd4_yield( void );
  70.  
  71. extern int
  72. pthd4_attr_create( pthread_attr_t *attr );
  73.  
  74. extern int 
  75. pthd4_attr_delete ( pthread_attr_t *attr);
  76.  
  77. extern long
  78. pthd4_attr_getstacksize( pthread_attr_t attr );
  79.  
  80. extern int
  81. pthd4_attr_setstacksize( pthread_attr_t *attr, long stacksize );
  82.  
  83. extern int 
  84. pthd4_create( pthread_t *thread,
  85.               pthread_attr_t attr,
  86.               pthread_startroutine_t start_routine,
  87.               pthread_addr_t arg );
  88.  
  89. extern int
  90. pthd4_detach( pthread_t *thread );
  91.  
  92. extern void
  93. pthd4_exit( pthread_addr_t status );
  94.  
  95. extern int 
  96. pthd4_join( pthread_t thread, pthread_addr_t *status );
  97.  
  98. extern pthread_t 
  99. pthd4_self( void );
  100.  
  101. extern int 
  102. pthd4_mutex_init( pthread_mutex_t *mutex, pthread_mutexattr_t attr );
  103.  
  104. extern int 
  105. pthd4_mutex_destroy( pthread_mutex_t *mutex );
  106.  
  107. extern int
  108. pthd4_mutex_lock( pthread_mutex_t *mutex );
  109.  
  110. extern int
  111. pthd4_mutex_trylock( pthread_mutex_t *mutex );
  112.  
  113. extern int
  114. pthd4_mutex_unlock( pthread_mutex_t *mutex );
  115.   
  116. extern int 
  117. pthd4_cond_init( pthread_cond_t *cond, pthread_condattr_t attr );
  118.  
  119. extern int 
  120. pthd4_cond_destroy( pthread_cond_t *cond );
  121.  
  122. extern int
  123. pthd4_cond_broadcast( pthread_cond_t *cond );
  124.  
  125. extern int
  126. pthd4_cond_signal( pthread_cond_t *cond );
  127.  
  128. extern int
  129. pthd4_cond_wait( pthread_cond_t *cond, pthread_mutex_t *mutex );
  130.  
  131. extern int
  132. pthd4_cond_timedwait( pthread_cond_t *cond,
  133.                       pthread_mutex_t *mutex,
  134.                       struct timespec *abstime );
  135.  
  136. extern int
  137. pthd4_once( pthread_once_t *once_block, void (*init_routine)(void) );
  138.  
  139. extern int 
  140. pthd4_keycreate( pthread_key_t *key, pthread_destructor_t destructor );
  141.  
  142. int 
  143. pthd4_setspecific( pthread_key_t key, pthread_addr_t value );
  144.  
  145. extern int 
  146. pthd4_getspecific( pthread_key_t key, pthread_addr_t *value );
  147.  
  148. extern int 
  149. pthd4_cancel( pthread_t thread );
  150.  
  151. extern void 
  152. pthd4_testcancel( void );
  153.  
  154. extern int 
  155. pthd4_setasynccancel( int state );
  156.  
  157. extern int 
  158. pthd4_setcancel( int state );
  159.  
  160. extern int 
  161. pthd4_get_expiration_np( struct timespec *delta, struct timespec *abstime );
  162.  
  163. extern int
  164. pthd4_delay_np( struct timespec *interval );
  165.  
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169.  
  170. #endif
  171.